package Text16;

import java.util.*;

public class Main {
    //ϕ(ab)=ab−1×ϕ(a)
//    由于答案可能很大，你只需要输出答案对 998244353取模的结果。
    static int mod = 998244353;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();
        long res = a, x = a;
        if(a==1){
            System.out.println(0);
            return;
        }
        for (int i = 2; i <= x / i; i++) {
            if (x % i == 0) {
                res = res / i * (i - 1) % mod;
                while (x % i == 0) {
                    x /= i;
                }
            }
        }
        if (x > 1) {
            res = res / x * (x - 1) % mod;
        }
        System.out.println(res * qmi(a, b - 1) % mod);
    }

    private static long qmi(long a, long b) {
        long ret = 1;
        while (b > 0) {
            if ((b & 1) == 1) {
                ret = ret * a % mod;
            }
            a = a * a % mod;
            b >>= 1;
        }
        return ret;
    }
}
